package main

import (
	"fmt"
	"github.com/gomodule/redigo/redis"
)

func main() {
	conn, err := redis.Dial("tcp", "192.168.3.108:6379")
	if err != nil {
		fmt.Println("连接Redis ERROR:", err)
		return
	}
	fmt.Println("连接Redis 成功:", conn)
	defer conn.Close()

	resSet, err := conn.Do("MSet", "k1", "v1", "k2", "v2", "k3", "v3")
	if err != nil {
		fmt.Println("Set Redis ERROR:", err)
		return
	}
	fmt.Println("Redis MSet:", resSet)

	resGet, err := redis.Strings(conn.Do("MGet", "k1", "k2", "k3"))
	if err != nil {
		fmt.Println("Get Redis ERROR:", err)
		return
	}
	fmt.Println("Redis MGet:", resGet)
	for _, v := range resGet {
		fmt.Println(v)
	}
}